package com.ayuku.retail.ui.pembelian;

import java.util.logging.Logger;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wb.swt.SWTResourceManager;

import com.ayuku.commons.AyBigDecimal;
import com.ayuku.commons.Util;

/**
 * 
 * @author putu kusuma <putukn@gmail.com>
 *
 */
public class CompPurchase extends org.eclipse.swt.widgets.Composite {

	protected Text txNama;
	protected Text txtAlamat;
	protected Text txtPhone;
	protected Text txtNoPelanggan;
	protected AyBigDecimal txtTagihan;
	protected Text txtEmail;
	protected Text txtKontak;
	private Label label7;
	private Label label5;
	private static Logger LOG = Logger.getLogger(CompPurchase.class.getName());

	public CompPurchase(final org.eclipse.swt.widgets.Composite parent,
			final int style) {
		super(parent, style);
		initGUI();
	}

	private void initGUI() {
		try {
			this.setBackground(SWTResourceManager.getColor(215, 213, 253));
			setLayout(new GridLayout(2, false));

			final Label label1 = new Label(this, SWT.NONE);
			label1.setText("Kode:");
			label1.setAlignment(SWT.RIGHT);
		
			label1.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label1.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));
			txtNoPelanggan = new Text(this, SWT.BORDER);
			txtNoPelanggan.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
			txtNoPelanggan.setTextLimit(20);
		
			txtNoPelanggan.setFont(SWTResourceManager.getFont("Tahoma", 10, 0,
					false, false));
			
						final Label label2 = new Label(this, SWT.NONE);
						label2.setText("Nama:");
						label2.setAlignment(SWT.RIGHT);
						
							label2.setBackground(SWTResourceManager.getColor(215, 213, 253));
							label2.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
									false));

			txNama = new Text(this, SWT.BORDER);
			txNama.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
			txNama.setTextLimit(20);
		
			txNama.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));
						
									label7 = new Label(this, SWT.NONE);
									label7.setText("Email:");
									label7.setAlignment(SWT.RIGHT);
									label7.setBackground(SWTResourceManager.getColor(215, 213, 253));
									label7.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
											false));
			
						txtEmail = new Text(this, SWT.BORDER);
						txtEmail.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
						txtEmail.setTextLimit(20);
						txtEmail.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
								false));

			final Label label6 = new Label(this, SWT.NONE);
			label6.setText("Alamat:");
			label6.setAlignment(SWT.RIGHT);
			
			label6.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label6.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));
						
									txtAlamat = new Text(this, SWT.BORDER);
									txtAlamat.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
									txtAlamat.setTextLimit(50);
									
										txtAlamat.setFont(SWTResourceManager.getFont("Tahoma", 10, 0,
												false, false));
			
						final Label label4 = new Label(this, SWT.NONE);
						label4.setText("Phone:");
						label4.setAlignment(SWT.RIGHT);
						
							label4.setBackground(SWTResourceManager.getColor(215, 213, 253));
							label4.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
									false));
			txtPhone = new Text(this, SWT.BORDER);
			txtPhone.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
			txtPhone.setTextLimit(30);
			
			txtPhone.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));
						
									final Label label3 = new Label(this, SWT.NONE);
									label3.setText("Tagihan:");
									label3.setAlignment(SWT.RIGHT);
									
										label3.setBackground(SWTResourceManager.getColor(215, 213, 253));
										label3.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
												false));
			
						txtTagihan = new AyBigDecimal(this, SWT.BORDER);
						GridData gd_txtTagihan = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1);
						gd_txtTagihan.widthHint = 195;
						txtTagihan.setLayoutData(gd_txtTagihan);
						txtTagihan.setFont(SWTResourceManager.getFont("Tahoma", 10, 0,
								false, false));

			label5 = new Label(this, SWT.NONE);
			label5.setText("Kontak Person:");
			label5.setAlignment(SWT.RIGHT);
			label5.setBackground(SWTResourceManager.getColor(215, 213, 253));
			label5.setFont(SWTResourceManager.getFont("Tahoma", 10, 0, false,
					false));
						
									txtKontak = new Text(this, SWT.BORDER);
									txtKontak.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
									txtKontak.setTextLimit(20);
									txtKontak.setFont(SWTResourceManager.getFont("Tahoma", 10, 0,
											false, false));

			this.layout();

		} catch (Exception e) {
			e.printStackTrace();
			LOG.info(e.getMessage());
			Util.showMsgBox("Gagal load: " + e.getMessage(), 1, getShell());
		}
	}
}
